package utilitarios;

import java.util.regex.Matcher;
import java.util.regex.Pattern;

public class Validacion {

	private static final String EMAIL_PATTERN = "^[_A-Za-z0-9-]+(\\.[_A-Za-z0-9-]+)*@"
			+ "[A-Za-z0-9]+(\\.[A-Za-z0-9]+)*(\\.[A-Za-z]{2,})$";
	private static final String CARACTERES_EXTRANOS = "[_a-zA-Z0-9]+";

	public static boolean validarCorreo(String correo) {
		Pattern pattern = Pattern.compile(EMAIL_PATTERN);
		Matcher matcher = pattern.matcher(correo);
		return matcher.matches();
	}

	public static boolean validarCaracteresRaros(String nombre) {
		Pattern pattern = Pattern.compile(CARACTERES_EXTRANOS);
		Matcher matcher = pattern.matcher(nombre);
		return matcher.matches();
	}
}
